package com.mark.web.data.enums;

/**
 * @Description: 订单状态的枚举类
 * @Author: Mark
 * @CreateDate: 2018/3/29.
 * @Version: 2.0
 * @Copyright : 豆浆油条个人非正式工作室
 */
public enum OrderStatusEnum {

    CANCELED(0,"已取消"),
    NO_PAY(10,"未支付"),
    PAID(20,"已付款"),
    SHIPPED(40,"已发货"),
    ORDER_SUCCESS(50,"已收货"),
    ORDER_CLOSE(60,"订单完成");


    OrderStatusEnum(int code, String information){
        this.code = code;
        this.information = information;
    }
    private String information;
    private int code;

    public String getInformation() {
        return information;
    }

    public int getCode() {
        return code;
    }

    public static OrderStatusEnum codeOf(int code){
        for(OrderStatusEnum orderStatusEnum : values()){
            if(orderStatusEnum.getCode() == code){
                return orderStatusEnum;
            }
        }
        throw new RuntimeException("没有有找到对应的枚举");
    }

}
